home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / zendisk1.zip / LST9-17.ASM < prev    next >
Assembly Source File  |  1990-02-15  |  794b  |  31 lines

  1. ;
  2. ; *** Listing 9-17 ***
  3. ;
  4. ; Supports the use of CX to store a loop count and CL
  5. ; to store a shift count by pushing and popping the loop
  6. ; count around the use of the shift count.
  7. ;
  8.     jmp    Skip
  9. ;
  10. ARRAY_LENGTH    equ    1000
  11. Array1    db    ARRAY_LENGTH dup (3)
  12. Array2    db    ARRAY_LENGTH dup (2)
  13. ;
  14. Skip:
  15.     mov    si,offset Array1 ;point to the source array
  16.     mov    di,offset Array2 ;point to the dest array
  17.     mov    ax,ds
  18.     mov    es,ax        ;copy to & from same segment
  19.     mov    cx,ARRAY_LENGTH    ;the loop count
  20.     mov    dl,2        ;the shift count
  21.     call    ZTimerOn
  22. ProcessingLoop:
  23.     lodsb            ;get the next byte
  24.     push    cx        ;save the loop count
  25.     mov    cl,dl        ;get the shift count into CL
  26.     shl    al,cl        ;shift the byte
  27.     pop    cx        ;get back the loop count
  28.     stosb            ;save the modified byte
  29.     loop    ProcessingLoop
  30.     call    ZTimerOff
  31.